!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! the subroutine is used interpolate maximum point of r-c-line through DE
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! coded by : B. G.
! created  : 2015-08-10
! revised  : 
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! nomenclature:
!   xx1~yy3 location values of three point
!   xx,yy   interpolated maximum point location
!   a,b,c   coefficients of quadratic equation y = a + b*x + c*x**2
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! warning:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

subroutine Interp(xx1,yy1,xx2,yy2,xx3,yy3,xx,yy)
   use VariableDef
   implicit none
   ! given variables
   real*8::xx1,yy1,xx2,yy2,xx3,yy3
   ! temporary variables
   real*8::a,b,c
   ! calculate variables
   real*8::xx,yy
   
   ! calculated a, b and c
   a=(yy1*xx2**2*xx3-yy1*xx2*xx3**2-xx1**2*yy2*xx3+xx1*yy2*xx3**2+xx1**2*xx2*yy3-&
         &xx1*xx2**2*yy3)/((xx2-xx1)*(xx2-xx3)*(xx3-xx1))
   b=(-yy1*xx2**2+yy1*xx3**2+xx1**2*yy2-yy2*xx3**2-xx1**2*yy3+xx2**2*yy3)/((xx1-xx2)&
         &*(xx1-xx3)*(xx2-xx3))
   c=(yy1*xx2-yy1*xx3-xx1*yy2+yy2*xx3+xx1*yy3-xx2*yy3)/((xx1-xx2)*(xx1-xx3)*(xx2-xx3))

   ! calculate xx and yy
   xx=-b/(2*c)
   yy=a+b*xx+c*xx**2

end subroutine Interp
